﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Authentication.Core.Data.DataContextStorage
{
    public class DataContextFactory
    {
        public static AuthenticationEntities GetDataContext()
        {
            IDataContextStorageContainer dataContextStorageContainer = DataContextStorageFactory.CreateStorageContainer();

            AuthenticationEntities authenticationEntities = dataContextStorageContainer.GetDataContext();

            if (authenticationEntities == null)
            {
                authenticationEntities = new AuthenticationEntities();
                dataContextStorageContainer.Store(authenticationEntities);
            }

            return authenticationEntities;
        }
    }
}
